package cn.momoky.ccool.mapper;

import cn.momoky.ccool.pojo.FileNode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface FileNodeMapper extends BaseMapper<FileNode> {

    void add(FileNode fileNode);

    void addAll(List<FileNode> nodeList);

    FileNode findByPath(String path);

    List<FileNode> findByLeftIn(@Param("start") Integer start, @Param("end") Integer end);

    void incrLeftById(@Param("id") Long id, @Param("step") Integer step);

    void incrRightById(@Param("id") Long id, @Param("step") Integer step);

    Integer incrLeftByLeftAfter(@Param("left") Integer left, @Param("step") Integer step);

    Integer incrRightByRightAfter(@Param("right") Integer right, @Param("step") Integer step);

    Integer updateState(@Param("id") Long id, @Param("state") Integer state);
}
